function [zenith, azimuth] = sun_positionST(dn, SolarTime, latt)

%Computes the sun position (zenith and azimuth angle)in solar time as a 
%function of the observer's location in terms of day number, solar time, 
%and position latitude).


%%%Hour Angle (w) - angular representation of solar time
    %w - in degrees, w = (solar time (in hours)-12)*15
    
w = (SolarTime-12)*15;

%%%Declination Angle (delta) - the angle between the earth's equatiorial 
%plane and the line joining the center of the sun and the earth
%delta = 23.45 (degrees) * sin((360/365)(dn-81))

delta = (asind((sind(23.45) * sind((360/365)*(dn-81)))));

%%%Altitude (alpha) - complement of the zenith angle (zenith)
sin_alpha = cosd(latt)*cosd(w)*cosd(delta) + sind(latt)*sind(delta);
cos_zenith = sin_alpha;
alpha = asind(sin_alpha);
zenith = acosd(cos_zenith);


%%%Azimuth Angle (azimuth)
cos_azimuth = (sind(alpha)*sind(latt) - sind(delta))/((cosd(alpha)*cosd(latt)));
azimuth = acosd(cos_azimuth);


%%%GOOD CHECK: AT SOLAR NOON, w = 0 AND zenith = abs(phi - delta) %%
%%%The azimuth should be approx 0 at solar noon on any day, between 0 and
%%90 in the mornings and between 0 and 270 in the evenings 
%%%
